package prop;

// Autor: Daniel Mart�nez Bou
// Cluster 3.2
// �ltima versi� 14/11/08

// ############ Format de la not�cia parsejada #############
//	  
//	 Mart� Pol      										(autor)
//	 La Vanguardia  										(font)
//	 Internet												(medi)
//	 Poesia													(secci�)
//	 30/06/2009												(data [DD/MM/AAAA])
//	 Pep Guardiola es un profesional com la copa d'un pi.   (contingut)
//	 M'agradiaria saber qui pensa que:
//	  -No serveix per res.
//	  -Es un incompetent.
//	  -�s molt lleig.
//	 Aquestes coses nom�s fan desprestigiar a un entranador i el distrauen d'aconseguir els objectius: com guanyar la Champions i la LLiga.
//	 Tot vostre,
//	 Mart� Pol

import java.io.Serializable;
import java.util.Date;



public final class NoticiaEstandard implements Serializable{
	
	// ############### Variables ###############
	
	private int id;
	private String path;
	private String idioma;
	private String contingut;
	private String[] discriminar = {"-",";",",","'",".",":","\n","\t","\r","(",")","[","]","?","�","!","�","=","/","&","�","%","$","$","�","#","|","\\","_","{","}"};
	
	// ############### M�todes ###############
	
	public NoticiaEstandard(){
	}
	
	public void setId(int id){
		this.id = id;
	}
	public int getId(){
		return this.id;
	}
	
	public void setPath(String path){
		this.path = path;
	}
	public String getPath(){
		return this.path;
	}
	
	public void setIdioma(String idioma){
		this.idioma = idioma;
	}
	
	public String getIdioma(){
		return this.idioma;
	}
	
	public void setContingut(String contingut){
		this.contingut = contingut;
	}
	
	public String getContingut(){
		return this.contingut;
	}
	
	private static Date convdata(String e) throws Exception{ // (DD/MM/AAAA)
		Date data = new Date();
		if(e.length() != 10) throw new Exception ("Incorrect Date Format (DD/MM/AAAA)");
		int dia = Integer.parseInt(e.substring(0, 2));
		int mes = Integer.parseInt(e.substring(3, 5));
		int any = Integer.parseInt(e.substring(6));
		if (dia < 1 || dia > 31)throw new Exception ("Incorrect Date Format (day)");
		if ((mes == 2) && (any%4 == 0) && (dia > 29))throw new Exception ("Incorrect Date Format (day)");
		if ((mes == 2) && !(any%4 == 0) && (dia > 28))throw new Exception ("Incorrect Date Format (day)");
		if ((mes == 4 || mes == 6 || mes == 9 || mes == 11) && dia > 30)throw new Exception ("Incorrect Date Format (day)");
		if (mes < 1 || mes > 12)throw new Exception ("Incorrect Date Format (month)");
		if (any < 1900)throw new Exception ("Incorrect Date Format (year)");
		data.setYear(any-1900); //1900+i
		data.setMonth(mes-1); //0-11
		data.setDate(dia); //1-31
		return data;
	}
	

	// ############### Joc de proves ###############
	

}